from flask import Blueprint
from flask_restful import Api
from comment.utils.output import output_json

user_bp = Blueprint('user', __name__, url_prefix='/user')  #创建蓝图
user_api = Api(user_bp)

# 使用定制好的返回到前端的json格式
user_api.representation('application/json')(output_json)

# 加载当前蓝图中的所有资源
from financial.resources.user.user_resource import *

user_api.add_resource(Login, '/login', endpoint='login')   # 登录的资源
user_api.add_resource(LoginOut, '/loginOut', endpoint='loginOut')                # 退出登录
user_api.add_resource(UserAvatar, '/avatar', endpoint='avatar')
user_api.add_resource(IsExistPhone, '/isExist', endpoint='isExist')   # 验证手机是否重复
user_api.add_resource(SmsCode, '/sms', endpoint='sms')   # 发送短信验证码
user_api.add_resource(RegisterUser, '/user-register', endpoint='register')   # 用户注册
user_api.add_resource(Invite, '/invite', endpoint='invite')   # 邀请码
user_api.add_resource(UserInfo, '/userInfo', endpoint='userInfo')   # 用户查询
user_api.add_resource(RealNameAuth, '/realName', endpoint='realName')            # 实名认证
user_api.add_resource(PayPassword, '/payPwd', endpoint='payPwd')
